﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Spring.Context;
using Spring.Context.Support;

namespace DI
{
    public class Spring
    {
        #region Spring 容器上下文  -SpringContext
        private static IApplicationContext SpringContext
        {
            get
            {
                return ContextRegistry.GetContext(); 
            }
        } 
        #endregion


        #region 获取配置文件 配置的对象 + T GetObject<T>(string objName) where T : class
        public static T GetObject<T>(string objName) where T : class
        {
            return (T)SpringContext.GetObject(objName);
        } 
        #endregion


    }
}
